package biz

import "github.com/golang-jwt/jwt/v4"

// GetJwtToken
//
//	@Description:
//	@param secretKey 密钥
//	@param iat 颁发时间
//	@param seconds 有效时间
//	@param payload 载荷
//	@return string
//	@return error
func GetJwtToken(secretKey string, iat int64, seconds int64, payload any) (string, error) {
	claims := make(jwt.MapClaims)
	claims["exp"] = iat + seconds
	claims["iat"] = iat
	claims["userId"] = payload
	token := jwt.New(jwt.SigningMethodHS256)
	token.Claims = claims
	return token.SignedString([]byte(secretKey))
}
